package com.atguigu.pamentdemo.controller;

import com.atguigu.pamentdemo.entity.Product;
import com.atguigu.pamentdemo.service.productService;
import com.atguigu.pamentdemo.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "商品管理")
@CrossOrigin
@RestController
@RequestMapping("/api/product")
public class ProductController {

    @Autowired
    private productService productService;

    @ApiOperation("商品列表")
    @GetMapping("/lsit")
    public R list(){
        List<Product> list = productService.list();
        return R.ok().data("productList",list);
    }

}
